home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 5 / BBS in a Box -Volume V (BBS in a Box) (April 1992).iso / Files / Prog / M / LSC213.cpt / TextEdit.h < prev    next >
Encoding:
C/C++ Source or Header  |  1987-09-26  |  3.0 KB  |  159 lines  |  [TEXT/KAHL]

  1.  
  2. /*
  3.  *  TextEdit.h
  4.  *
  5.  *  Copyright (c) 1986, 1987 THINK Technologies, Inc.
  6.  *  These interfaces are based on information copyrighted
  7.  *  by Apple Computer, Inc., 1985, 1986, 1987.
  8.  *
  9.  */
  10.  
  11. #ifndef    _TextEdit_
  12. #define _TextEdit_
  13.  
  14. #ifndef    _Quickdraw_
  15. #include "Quickdraw.h"
  16. #endif
  17.  
  18. /* justifications */
  19. enum { teForceLeft = -2, teJustRight, teJustLeft, teJustCenter };
  20.  
  21. typedef    char Chars[1], *CharsPtr, **CharsHandle;
  22.  
  23. typedef    struct
  24.     {
  25.     Rect    destRect ;
  26.     Rect    viewRect ;
  27.     Rect    selRect ;
  28.     int        lineHeight ;
  29.     int        fontAscent ;
  30.     Point    selPoint ;
  31.     int        selStart ;
  32.     int        selEnd ;
  33.     int        active ;
  34.     ProcPtr    wordBreak ;
  35.     ProcPtr    clikLoop ;
  36.     long    clickTime ;
  37.     int        clickLoc ;
  38.     long    caretTime ;
  39.     int        caretState ;
  40.     int        just ;
  41.     int        teLength ;
  42.     Handle    hText ;
  43.     int        recalBack ;
  44.     int        recalLines;
  45.     int        clikStuff ;
  46.     int        crOnly ;
  47.     int        txFont ;
  48.     char    txFace ;
  49.     int        txMode ;
  50.     int        txSize ;
  51.     GrafPtr    inPort ;
  52.     ProcPtr    highHook ;
  53.     ProcPtr caretHook ;
  54.     int        nLines ;
  55.     int        lineStarts[];
  56.     } TERec, *TEPtr, **TEHandle ;
  57.  
  58.  
  59. /* ---------- new TE stuff ("with style") ---------- */
  60.  
  61.  
  62. #define doFont            1
  63. #define doFace            2
  64. #define doSize            4
  65. #define doColor            8
  66. #define doAll            15
  67. #define addSize            16
  68.  
  69.  
  70. /*  avoid having to bring in all of Color Quickdraw  */ 
  71. typedef struct _RGBColor{
  72.     unsigned short    red;
  73.     unsigned short    green;
  74.     unsigned short    blue;
  75. } _RGBColor;
  76.         
  77.  
  78. typedef struct StyleRun{
  79.     short            startChar;
  80.     short            styleIndex;
  81. } StyleRun;
  82.  
  83. typedef struct STElement{
  84.     short            stCount;
  85.     short            stHeight;
  86.     short            stAscent;
  87.     short            stFont;
  88.     Style            stFace;
  89.     short            stSize;
  90.     _RGBColor        stColor;
  91. } STElement;
  92.  
  93. typedef STElement TEStyleTable[1777], *STPtr, **STHandle;
  94.         
  95. typedef struct LHElement{
  96.     short            lhHeight;
  97.     short            lhAscent;
  98. } LHElement;
  99.                           
  100. typedef LHElement LHTable[8001], *LHPtr, **LHHandle;
  101.  
  102. typedef struct ScrpSTElement{
  103.     long            scrpStartChar;
  104.     short            scrpHeight;
  105.     short            scrpAscent;
  106.     short            scrpFont;
  107.     Style            scrpFace;
  108.     short            scrpSize;
  109.     _RGBColor        scrpColor;
  110. } ScrpSTElement;
  111.         
  112. typedef ScrpSTElement ScrpSTTable[1601];
  113.  
  114. typedef struct StScrpRec{
  115.     short            scrpNStyles;
  116.     ScrpSTTable        scrpStyleTab;
  117. } StScrpRec, *StScrpPtr, **StScrpHandle;
  118.       
  119. typedef struct NullStRec{
  120.     long            teReserved;
  121.     StScrpHandle    nullScrap;
  122. } NullStRec, *NullStPtr, **NullStHandle;
  123.  
  124. typedef struct TEStyleRec{
  125.     short            nRuns;
  126.     short            nStyles;
  127.     STHandle        styleTab;
  128.     LHHandle        lhTab;
  129.     long            teRefCon;
  130.     NullStHandle    nullStyle;
  131.     StyleRun        runs[8001];
  132. } TEStyleRec, *TEStylePtr, **TEStyleHandle;
  133.  
  134. typedef struct TextStyle{
  135.     short            tsFont;
  136.     Style            tsFace;
  137.     short            tsSize;
  138.     _RGBColor        tsColor;
  139. } TextStyle;
  140.  
  141.  
  142. /* ---------- */
  143.  
  144.  
  145. /*  functions returning non-integral values  */
  146. pascal TEHandle TENew();
  147. pascal CharsHandle TEGetText();
  148. pascal Handle TEScrapHandle();
  149. pascal TEHandle TEStylNew();
  150. pascal TEStyleHandle GetStylHandle();
  151. pascal StScrpHandle GetStylScrap();
  152. /*pascal Point TEGetPoint();  -- actually returns a long  */
  153.  
  154. /*  low-memory globals  */
  155. extern int TEScrpLength : 0xAB0;
  156. extern Handle TEScrpHandle : 0xAB4;
  157.  
  158.  
  159. #endif _TextEdit_